package com.bridge.applets.utils;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.bridge.applets.model.bo.BaseResult;
import com.bridge.applets.model.bo.BridgeResultData;
import com.bridge.common.utils.HttpTookit;
import org.apache.commons.lang3.StringUtils;

import java.util.HashMap;
import java.util.Map;

public class HttpUtils {



    public static String postBodyParam(String url, Map<String,Object> param) {
        String result = HttpTookit.postBodyParam(url, param, new HashMap());
        if (StringUtils.isEmpty(result)) {
            return null;
        }
        return result;
    }


    public static BaseResult<BridgeResultData> postAnalysis(String url, Map<String,Object> param){
        String result = postBodyParam(url, param);
        if(StringUtils.isEmpty(result)){
            return null;
        }

       return JSON.parseObject(result,new TypeReference<BaseResult<BridgeResultData>>(){});
    }

}
